package com.david.interview.step1;

/**
 * 懒汉式--加锁 性能不好 每次获取都需要加锁
 * @author David
 * @version V1.0
 * @Package com.david.interview.step1
 * @date 2021/6/29 23:37
 */
public class P02Singleton5 {
    public static P02Singleton5 INSTANCE;
    private P02Singleton5(){}
    public static P02Singleton5 getInstance(){

        synchronized (P02Singleton5.class){
            if (INSTANCE==null){
                INSTANCE=new P02Singleton5();
            }
        }
        return INSTANCE;
    }
}
